#include<iostream>
using namespace std;
typedef long long LL;
const int mod = 1e9 + 7;
LL fun(LL a, LL b)
{
	LL ans = 1;
	while (b) {
		if (b & 1) {
			ans = (ans * a) % mod;
			ans %= mod;
		}
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}
LL n;
int main()
{
	cin >> n;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	//cout << fun(2, 51);
	cout << n * (n - 1) / 2 % mod * fun(2, n - 1) % mod << endl;
	return 0;
}